package ipebg.mzk.common.util;

import java.util.List;



public class PaginationSupport<E> {
	private int totalCount;
	private int totalPage;
	private int countPerPage;
	private int curPage;
	private List<E> resultList;

	public PaginationSupport(List<E> list, int curPage, int countPerPage, int totalCount) {
		setCountPerPage(countPerPage);
		setTotalCount(totalCount);
		setTotalPage(totalPage);
		setCurPage(curPage);
		setResultList(list);
	}

	
	
	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		if (totalCount > 0) {
			if (totalCount <= countPerPage) {
				this.totalPage = 1;
			}
			if (totalCount > countPerPage) {
				if (totalCount % countPerPage != 0) {
					this.totalPage = totalCount / countPerPage + 1;
				}
				if (totalCount % countPerPage == 0) {
					this.totalPage = totalCount / countPerPage;
				}
			}
		} else {
			this.totalPage = 1;
		}
	}

	public int getCountPerPage() {
		return countPerPage;
	}

	public void setCountPerPage(int countPerPage) {
		this.countPerPage = countPerPage;
	}

	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}



	public List<E> getResultList() {
		return resultList;
	}



	public void setResultList(List<E> resultList) {
		this.resultList = resultList;
	}

	
}
